#ifndef __ACCOUNT_H__
#define __ACCOUNT_H_
#include <pthread.h>

////建议互斥锁和共享的资源绑定，尽量不要设置成全局变量，要不然并发性会降低

typedef struct {
    int code;           //账户号码
    double balance;      //账户的余额
    //定义一把互斥锁，对多线程操i做的账户进行加锁
    pthread_mutex_t mutex;
}Account;

//创建账户
extern Account*create_account(int code,double balance);



//销毁账户
extern void destroy_account(Account*a);


//取款

extern double withdraw(Account*a,double amt);


//存款
extern double deposit(Account*a,double amt);


//查看账户余额
extern double get_balance(Account*a);

#endif